quartz: handle recursive CFRunLoops
authorMichael Natterer <mitch@lanedo.com>
Sun, 6 Nov 2011 22:12:57 +0000 (23:12 +0100)
committerMichael Natterer <mitch@gimp.org>
Sun, 6 Nov 2011 22:38:50 +0000 (23:38 +0100)
commitd1c6bcb85c5eb37b9b9b82bfb973853b07aa06a0
treeb1f1fec263b05f5f222087fc07c8e7d314dc4edd
parent4ef61e231114c0a9b64384e5d545a5ff2a012cf6
quartz: handle recursive CFRunLoops

Fixes e.g. crashs when dropping from finder.

Turn the "getting_events" boolean into a counter to handle poll_func()
being called recursively, and track the loop depth correctly by
changing its counter before bailing out in run_loop_observer_callback().
This way we reallocate our autorelease pool at the right time, and
don't kill memory that is still in use by outer run loops.

Also drain, not release the pool, just for some defensive forward
compatibility.
(cherry picked from commit ef9a92d225f7257f56c3a8b7b28ddd9a734e38e6)
gdk/quartz/gdkeventloop-quartz.c